importPackage(net.sf.odinms.client);

var status = 0;

function start() {
	status = -1;
	action(1, 0, 0);
}

function action(mode, type, selection) {
	if (mode == -1) {
		cm.dispose();
	} else {
		if (mode == 0) {
			if (status == 2) {
				cm.sendOk("I see... well, selecting a new job is a very important decision to make. If you are ready, then let me know!..");
				cm.dispose();
				return;
			} else {
				status--;
				status--;
				mode++;
			}
		}
		if (mode == 1)
			status++;
		else
			status--;
		if (status == 0) {
			if (cm.getJob().equals(MapleJob.BEGINNER)) {
				cm.sendSimple("Have you got something to say?..\r\n#b#L0# I would like to learn more about pirates..#l");
			} else if (cm.getJob().equals(MapleJob.PIRATE)) {
				if (cm.checkQuestStatus(2191, 2) || cm.checkQuestStatus(2192, 2))
					cm.sendOk("You can advance!");
				else
					cm.sendOk("Hello there, are you willing to advance?\r\nDo my quest first");
				cm.dispose();
			}
		} else if (status == 1) {
			cm.sendNext("Do you wish to become a Pirate? You'll need to meet our set of standard if you are to become one of us. I need you to be #bat least at Level 10, with DEX at 20 or above#k. Let's see.....");
		} else if (status == 2) {
			if (cm.getChar().getDex() >= 20 && cm.getLevel() >= 10) {
				cm.sendYesNo("You seem more than qualified! Great, are you ready to become one of us?");
			} else {
				cm.sendOk("It seems that you do not meet the correct requirements. Please come back if you are Lv10 and have at least 20 Dex");
				cm.dispose();
			}
		} else if (status == 3) {
			cm.sendNext("Welcome to the band of Pirates! You may have to spend some time as a wanderer at first, but better days will certainly dawn upon you, sooner than you think! In the mean time, let me share some of my abilities with you...");
			cm.getChar().changeJob(MapleJob.PIRATE);
		} else if (status == 4) {
			cm.sendNext("I have just increased the number of slots for your equipment and etc. inventory. You have also gotten a bit stronger. Can you feel it? Now that you can officially call yourself a Pirate, join us in our quest for adventure and freedom!..");
		} else if (status == 5) {
			cm.sendNextPrev("I have just given you a little bit of #bSP#k. Look at the #bSkill menu#k to find some skills, and use your SP to learn the skills. Beware that not all skills can be enhanced from the get go. There are some skills that you can only acquire after mastering basic skills...");
		} else if (status == 6) {
			cm.sendNextPrev("One more thing. Now that you have graduated from the ranks of a Beginner into a Pirate, you'll have to make sure not to die prematurely. If you do lose all your health, you'll lose valuable EXP that you have earned. Wouldn't it stink to lose hard-earned EXP by dying?..");
		} else if (status == 7) {
			cm.sendNextPrev("This is all I can teach you. I have also given you some useful weapons to work with, so it's up to you now to train with them. The world is yours for the taking, so use your resources wisely, and when you feel like you've reached the top, let me know. I'll have something better for you in store.....");
		} else if (status == 8) {
			cm.sendPrev("Oh, and... if you have more questions about being a Pirate, or if you need some pointers...you can always ask me. I'll see you around.....");
		} else {
			cm.dispose();
		}
	}
}	